Trace-based compilers, which detect and compile a frequently executed linear instruction sequence on the basis of an execution profile, are known. Like optimization by guarded method inlining, a trace-based compiler inserts a guard called a virtual call guard used in runtime for checking whether a method recorded in a trace is the same as a method to be executed where a method to be invoked at the boundary between methods cannot uniquely be determined. A method that has this nature is known as a virtual method. A virtual method is a function for implementing “polymorphism”, which is one of features of object-oriented languages.
There are two approaches to using a guard to perform the check described above. One, called class test, compares a class of a receiver object used for a virtual method call (an object used for determining a method to be actually invoked, hereinafter the same applies) at the recording time of the trace with an run-time class of the receiver object to determine whether the methods are the same (for example, see Patent Literatures 1 and 2). The other, called method test, checks whether the run-time class of a receiver object used in a virtual method call is a class that calls an inlined method.
For an optimization using guarded method inlining, there is a guard technique known as polymorphic inline cache (PIC). In the most classical virtual call guard optimization techniques, a call target is searched for every time a virtual method call is made. To avoid this, a technique called inline cache (IC) has been developed in which the most frequently appearing class at a call site is determined before a call, thereby avoiding searches in many situations. PIC is a technique that extends the IC to check multiple classes that frequently appear at a call site before a call (for example, see Non Patent Literature 1).
There is another technique that includes checking of the type of an object passed as a parameter, in addition to checking of the type of a receiver object of a virtual method that has an object reference as a parameter when the virtual method is inlined (for example see Patent Literature 3).